package com.zs.zcerp.entrance.service.impl;


import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zs.zcerp.entrance.entity.DpDept;
import com.zs.zcerp.entrance.mapper.DpDeptMapper;
import com.zs.zcerp.entrance.service.IDpDeptService;
import org.springframework.stereotype.Service;

import java.util.Calendar;
import java.util.List;

@DS("oracle")
@Service
public class DpDeptServiceImpl extends ServiceImpl<DpDeptMapper, DpDept> implements IDpDeptService {

    @Override
    public List<DpDept> listDpDepts() {
        return baseMapper.selectList(new QueryWrapper<DpDept>().orderByAsc("ORG_ID, DEPT_NO"));
    }

    @Override
    public List<DpDept> listDpDeptsLately() {
        Calendar c = Calendar.getInstance();
        c.add(Calendar.DATE, -1);
        return baseMapper.selectList(new QueryWrapper<DpDept>().gt("LAST_DATE",c.getTime()).orderByAsc("ORG_ID, DEPT_NO"));
    }

}
